package com.elitel.frame.business.filter.config;

import com.elitel.frame.business.filter.serverparam.ParamTranslateFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean requsetBodyToParamFilter() {
        // 这里需要特别注意的是RequsetBodyToParamFilter已经将请求体中的数据读取完了,此时请求体中的数据为空
        FilterRegistrationBean registration = new FilterRegistrationBean(new ParamTranslateFilter());
        registration.addUrlPatterns("/business/singleServer/querySingleTB");
        registration.addUrlPatterns("/business/multipleServer/multipleTableServer");
        registration.addUrlPatterns("/business/polymerServer/queryPolymerServer");
        registration.addUrlPatterns("/business/fileServer/queryFileServer");
        return registration;
    }
}
